package io;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;

public class RandomFileTest {
    public static void main(String[] args) {
        try(
//                RandomAccessFile file =
//                        new RandomAccessFile(
//                                new File("C:\\Users\\Administrator\\Desktop\\日报"),
//                                "rw");
                RandomAccessFile targetFile =
                        new RandomAccessFile(new File("C:\\Users\\Administrator\\Desktop\\empty.txt"),
                                "rw");


                )
        {
//            System.out.println(file.readLine());
            String s = targetFile.readLine()+"\nccccc";
            targetFile.seek(0);
            targetFile.writeBytes(s);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
